package com.lmxdawn.api.admin.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;
@Slf4j
public class MyValSerializer extends GenericJackson2JsonRedisSerializer {
    @Override
    public <T> T deserialize(byte[] source, Class<T> type) throws SerializationException {
        try {
            return super.deserialize(source, type);
        }catch (Exception e){
            log.debug("deserialize error: {}", e.getMessage());
            try {
                return (T) new String(source);
            }catch (Exception e1){
                return null;
            }
        }
    }
}
